public class LinkedList<E> {
    private class Node{
        public E e;
        public Node next;
        Node(E e,Node next){
            this.e=e;
            this.next=next;
        }
        Node(E e){
            this(e, null);
        }
        Node(Node next){
            this(null,next);
        }
    }
    private Integer size;
    private Node head;
    LinkedList(){
        this.head=null;
        this.size=0;
    }
    public void addFirstNode(E e){
        Node node=new Node(e);
        node.next=this.head;
        size++;
    }
    public void addNode(E e,int idx){
        //初始化头结点为当前结点
        Node currentNode=head;
        for (int i = 0; i < idx; i++) {
            //第i个节点
            currentNode=currentNode.next;
        }
        // Node newNode=new Node(e);
        // newNode.next=currentNode.next;
        // currentNode.next=newNode;
        currentNode.next=new Node(e,currentNode.next);
        size++;
    }
}